﻿//<TunynetCopyright>
//--------------------------------------------------------------
//<copyright>青岛拓宇网络科技有限公司 2005-2008</copyright>
//<version>V0.5</verion>
//<createdate>2008-3-3</createdate>
//<author>mazq</author>
//<email>mazq@tunynet.com</email>
//<log date="2008-3-3">创建</log>
//--------------------------------------------------------------
//</TunynetCopyright>


using System;
using System.Collections.Generic;
using System.Text;
using System.Workflow.ComponentModel;
using System.Workflow.Activities;
using System.ComponentModel;
using System.Workflow.Runtime;
using ChinaCustoms.Qingdao.Workflow.Supports;
using System.Drawing.Design;
using ChinaCustoms.Qingdao.Workflow.Activities.Chooser;
using System.Drawing;
using System.ComponentModel.Design;

namespace ChinaCustoms.Qingdao.Workflow.Activities
{
    /// <summary>
    /// 海关工作流子流程
    /// </summary>
    [PersistOnClose]
    [ToolboxBitmap(typeof(SubFlowActivity), "Resources.gearset.png")]
    [Designer(typeof(SubFlowActivityDesigner), typeof(IDesigner))]
    public partial class SubFlowActivity : ChinaCustomsBaseActivity
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public SubFlowActivity()
        {
            InitializeComponent();
        }

        #region Properties

        public static DependencyProperty CodeNameProperty = System.Workflow.ComponentModel.DependencyProperty.Register("CodeName", typeof(string), typeof(SubFlowActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata));

        [Description("活动编码(必须填写,并且要唯一,只允许在设计期间修改)")]
        [Category("活动")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public override string CodeName
        {
            get
            {
                string codeName = string.Empty;
                try
                {
                    codeName = (string)base.GetValue(SubFlowActivity.CodeNameProperty);
                }
                catch { }

                return codeName;
            }
            set { base.SetValue(SubFlowActivity.CodeNameProperty, value); }
        }

        public static DependencyProperty UrlOfWorkItemProperty = System.Workflow.ComponentModel.DependencyProperty.Register("UrlOfWorkItem", typeof(string), typeof(SubFlowActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata));

        [Description("处理或浏览该活动的工作项时调用的URL")]
        [Category("活动")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public override string UrlOfWorkItem
        {
            get { return base.GetValue(SubFlowActivity.UrlOfWorkItemProperty) as string; }
            set { base.SetValue(SubFlowActivity.UrlOfWorkItemProperty, value); }
        }


        public static DependencyProperty ActivityLevelProperty = System.Workflow.ComponentModel.DependencyProperty.Register("ActivityLevel", typeof(int), typeof(SubFlowActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata));

        [Description("活动级别(必须填写,并且要唯一)")]
        [Category("活动")]
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public override int ActivityLevel
        {
            get
            {
                int activityLevel = 0;
                try
                {
                    activityLevel = (int)base.GetValue(SubFlowActivity.ActivityLevelProperty);
                }
                catch { }

                return activityLevel;
            }
            set { base.SetValue(SubFlowActivity.ActivityLevelProperty, value); }
        }


        //public static DependencyProperty AllowRedesignateExecutorProperty = System.Workflow.ComponentModel.DependencyProperty.Register("AllowRedesignateExecutor", typeof(bool), typeof(SubFlowActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata));

        //[Description("是否允许运行时由前一个活动执行人指定该活动执行人")]
        //[Category("常用设置")]
        //[Browsable(true)]
        //[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        //public override bool AllowRedesignateExecutor
        //{
        //    get
        //    {
        //        bool allowRedesignateExecutor = true;
        //        try
        //        {
        //            allowRedesignateExecutor = (bool)base.GetValue(SubFlowActivity.AllowRedesignateExecutorProperty);
        //        }
        //        catch { }

        //        return allowRedesignateExecutor;
        //    }
        //    set { base.SetValue(SubFlowActivity.AllowRedesignateExecutorProperty, value); }
        //}

        //public static DependencyProperty AllowPostilProperty = System.Workflow.ComponentModel.DependencyProperty.Register("AllowPostil", typeof(bool), typeof(SubFlowActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata));

        //[Description("是否允许填写审批意见")]
        //[Category("常用设置")]
        //[Browsable(true)]
        //[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        //public override bool AllowPostil
        //{
        //    get
        //    {
        //        bool allowPostil = true;
        //        try
        //        {
        //            allowPostil = (bool)base.GetValue(SubFlowActivity.AllowPostilProperty);
        //        }
        //        catch { }

        //        return allowPostil;
        //    }
        //    set { base.SetValue(SubFlowActivity.AllowPostilProperty, value); }
        //}


        //public static DependencyProperty AllowFinalJudgmentProperty = System.Workflow.ComponentModel.DependencyProperty.Register("AllowFinalJudgment", typeof(bool), typeof(SubFlowActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata));

        //[Description("是否允许办结")]
        //[Category("常用设置")]
        //[Browsable(true)]
        //[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        //public bool AllowFinalJudgment
        //{
        //    get
        //    {
        //        bool allowFinalJudgment = true;
        //        try
        //        {
        //            allowFinalJudgment = (bool)base.GetValue(SubFlowActivity.AllowFinalJudgmentProperty);
        //        }
        //        catch { }

        //        return allowFinalJudgment;
        //    }
        //    set { base.SetValue(SubFlowActivity.AllowFinalJudgmentProperty, value); }
        //}


        //public static DependencyProperty ActivityCodeNamesForJumpProperty = System.Workflow.ComponentModel.DependencyProperty.Register("ActivityCodeNamesForJump", typeof(string), typeof(SubFlowActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata));

        //[Description("可跳转到的活动编码，多个活动编码使用逗号分割")]
        //[Category("常用设置")]
        //[Browsable(true)]
        //[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        //public override string ActivityCodeNamesForJump
        //{
        //    get
        //    {
        //        string activityCodeNamesForJump = string.Empty;
        //        try
        //        {
        //            activityCodeNamesForJump = base.GetValue(SubFlowActivity.ActivityCodeNamesForJumpProperty) as string;
        //        }
        //        catch { }

        //        return activityCodeNamesForJump;
        //    }
        //    set { base.SetValue(SubFlowActivity.ActivityCodeNamesForJumpProperty, value); }
        //}

        //public static DependencyProperty AllowBackProperty = System.Workflow.ComponentModel.DependencyProperty.Register("AllowBack", typeof(bool), typeof(SubFlowActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata));

        //[Description("是否允许回退到前一个活动")]
        //[Category("常用设置")]
        //[Browsable(true)]
        //[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        //public override bool AllowBack
        //{
        //    get
        //    {
        //        bool allowBack = true;
        //        try
        //        {
        //            allowBack = (bool)base.GetValue(SubFlowActivity.AllowBackProperty);
        //        }
        //        catch { }

        //        return allowBack;
        //    }
        //    set { base.SetValue(SubFlowActivity.AllowBackProperty, value); }
        //}

        public static DependencyProperty RequiredDepartmentIDsProperty = System.Workflow.ComponentModel.DependencyProperty.Register("RequiredDepartmentIDs", typeof(string), typeof(SubFlowActivity));

        [Description("活动对应的直接部门")]
        [Category("常用设置")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        [Editor(typeof(ChooserForGeneralOrganization), typeof(UITypeEditor))]
        public string RequiredDepartmentIDs
        {
            get { return base.GetValue(SubFlowActivity.RequiredDepartmentIDsProperty) as string; }
            set { base.SetValue(SubFlowActivity.RequiredDepartmentIDsProperty, value); }
        }

        //public static DependencyProperty RequiredUserNamesProperty = System.Workflow.ComponentModel.DependencyProperty.Register("RequiredUserNames", typeof(string), typeof(SubFlowActivity));

        //[Description("需要操作该活动的用户名列表,多个用户名用逗号分隔")]
        //[Category("常用设置")]
        //[Browsable(true)]
        //[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        //[Editor(typeof(ChooserForGeneralUser), typeof(UITypeEditor))]
        //public override string RequiredUserNames
        //{
        //    get { return base.GetValue(SubFlowActivity.RequiredUserNamesProperty) as string; }
        //    set { base.SetValue(SubFlowActivity.RequiredUserNamesProperty, value); }
        //}

        public static DependencyProperty OnlyShowRelativeTopLevelInOrganizationSelectorOfSubFlowProperty = System.Workflow.ComponentModel.DependencyProperty.Register("OnlyShowRelativeTopLevelInOrganizationSelectorOfSubFlow", typeof(bool), typeof(SubFlowActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata));

        [Description("发起子流程打开部门选择器时是否只显示相对顶级部门")]
        [Category("子流程设置")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public bool OnlyShowRelativeTopLevelInOrganizationSelectorOfSubFlow
        {
            get
            {
                bool onlyShowRelativeTopLevelInOrganizationSelectorOfSubFlow = true;
                try
                {
                    onlyShowRelativeTopLevelInOrganizationSelectorOfSubFlow = (bool)base.GetValue(SubFlowActivity.OnlyShowRelativeTopLevelInOrganizationSelectorOfSubFlowProperty);
                }
                catch { }

                return onlyShowRelativeTopLevelInOrganizationSelectorOfSubFlow;
            }
            set { base.SetValue(SubFlowActivity.OnlyShowRelativeTopLevelInOrganizationSelectorOfSubFlowProperty, value); }
        }

        public static DependencyProperty SubFlowXmlFileProperty = System.Workflow.ComponentModel.DependencyProperty.Register("SubFlowXmlFile", typeof(string), typeof(SubFlowActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata));

        [Description("子流程XML文件")]
        [Category("子流程设置")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public string SubFlowXmlFile
        {
            get { return base.GetValue(SubFlowActivity.SubFlowXmlFileProperty) as string; }
            set { base.SetValue(SubFlowActivity.SubFlowXmlFileProperty, value); }
        }


        public static DependencyProperty RequireFeedbackProperty = System.Workflow.ComponentModel.DependencyProperty.Register("RequireFeedback", typeof(bool), typeof(SubFlowActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata));

        [Description("是否需要子流程反馈")]
        [Category("子流程设置")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public bool RequireFeedback
        {
            get
            {
                bool requireFeedback = true;
                try
                {
                    requireFeedback = (bool)base.GetValue(SubFlowActivity.RequireFeedbackProperty);
                }
                catch { }

                return requireFeedback;
            }
            set { base.SetValue(SubFlowActivity.RequireFeedbackProperty, value); }
        }


        public static DependencyProperty StartSubFlowAndStopThisFlowProperty = System.Workflow.ComponentModel.DependencyProperty.Register("StartSubFlowAndStopThisFlow", typeof(bool), typeof(SubFlowActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata));

        [Description("分发子流程并办结，子流程分发后主流程停止等待所有子流程完成后办结整个工作流实例")]
        [Category("子流程设置")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public bool StartSubFlowAndStopThisFlow
        {
            get
            {
                bool noMoveAfterDistributeSubFlow = true;
                try
                {
                    noMoveAfterDistributeSubFlow = (bool)base.GetValue(SubFlowActivity.StartSubFlowAndStopThisFlowProperty);
                }
                catch { }

                return noMoveAfterDistributeSubFlow;
            }
            set { base.SetValue(SubFlowActivity.StartSubFlowAndStopThisFlowProperty, value); }
        }

        #endregion

    }
}
